<template>
  <div class="drawer_box_son">
    <div class="back_btn">
      <el-button type="primary" circle :icon="Back" @click="back_btn" />
    </div>
    <!-- 罪犯 -->
    <div class="zf_box" v-if="types == '罪犯'" style="width: 97%">
      <div class="type_box_text">
        {{ data.exceptType }}
      </div>
      <el-tabs v-model="activeName" type="card" @tab-click="handleClickTab">
        <el-tab-pane
          :label="stateYc ? '上报' : bjchShow == 'bj' ? '编辑' : '处理'"
          name="sb"
        ></el-tab-pane>
        <el-tab-pane label="记录" name="jl"></el-tab-pane>
        <!-- <el-tab-pane label="已处理" name="ycl"></el-tab-pane> -->
      </el-tabs>
      <div class="list_box isTable" v-if="activeName == 'jl'">
        <el-table
          :data="ycqkList"
          fit
          highlight-current-row
          stripe
          height="380"
          style="width: 100%"
          border
        >
          <el-table-column prop="startDate" label="时间" align="center">
            <template #default="scope">
              <div>
                {{
                  scope.row.createDate.split("T")[0] +
                  " " +
                  scope.row.createDate.split("T")[1].split(":")[0] +
                  ":" +
                  scope.row.createDate.split("T")[1].split(":")[1]
                }}
              </div>
            </template>
          </el-table-column>

          <el-table-column prop="ld" label="异常描述" align="center">
            <template #default="scope">
              {{ scope.row.content }}
            </template>
          </el-table-column>
          <el-table-column prop="ld" label="处理情况" align="center">
            <template #default="scope">
              {{ scope.row.handleContent }}
            </template>
          </el-table-column>
          <el-table-column prop="ld" label="操作" width="200" align="center">
            <template #default="scope">
              <el-button
                size="small"
                type="primary"
                @click.stop="handleEdit(scope.$index, scope.row)"
              >
                编辑
              </el-button>
              <el-button
                size="small"
                type="primary"
                @click.stop="handleEditcl(scope.$index, scope.row)"
              >
                处理
              </el-button>

              <el-popconfirm
                title="确认删除嘛"
                @confirm.stop="handleDelete(scope.row)"
              >
                <template #reference>
                  <el-button size="small" type="danger"> 删除 </el-button>
                </template>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
      </div>

      <!-- 上报 -->
      <div v-if="activeName == 'sb'">
        <!-- 新增 -->

        <div style="display: flex" v-if="stateYc">
          <div style="display: flex; margin-bottom: 10px">
            <div
              style="min-width: 67px"
              v-if="data.exceptType == '指挥中心例行研判'"
              class="flex_center_center"
            >
              研判结果：
            </div>

            <el-radio-group
              v-model="ycqkObj.reportState"
              v-if="data.exceptType == '指挥中心例行研判'"
            >
              <el-radio value="1" size="large">上报</el-radio>
              <el-radio value="2" size="large">通报</el-radio>
              <el-radio value="3" size="large">预警</el-radio>
              <el-radio value="4" size="large">汇总</el-radio>
            </el-radio-group>
          </div>
        </div>

        <div
          v-if="bjchShow != 'bj'"
          style="display: flex; justify-content: space-between"
        >
          <!-- <div style="display: flex; margin-bottom: 10px" v-if="!stateYc">
              <div style="width: 67px" class="flex_center_center">类型:</div>
              <div>{{ ycqkObj.type }}</div>
      
            </div> -->
          <div style="display: flex; margin-bottom: 10px" v-if="!stateYc">
            <div style="width: 67px" class="flex_center_center">上报人:</div>
            <div>
              {{ ycqkObj.reportUserName }}
            </div>
          </div>
        </div>
        <div v-if="bjchShow != 'bj'" style="display: flex; margin-bottom: 10px">
          <div
            style="min-width: 70px"
            class="flex_center_center"
            v-if="data.exceptType == '指挥中心例行研判'"
          >
            分析研判:
          </div>
          <div v-else style="min-width: 70px" class="flex_center_center">
            情况说明
          </div>
          <div
            v-if="!stateYc"
            style="height: 136px; display: flex; align-items: center"
          >
            {{ ycqkObj.content }}
          </div>
          <el-input
            v-else
            :disabled="!stateYc"
            v-model="ycqkObj.content"
            :rows="6"
            type="textarea"
            placeholder="请输入"
          />
        </div>
        <!-- 处理 -->
        <div v-if="!stateYc">
          <el-divider content-position="left">
            {{ bjchShow == "bj" ? "编辑" : "处理" }}
          </el-divider>
          <!-- <div style="display: flex; margin-bottom: 10px">
              <div style="width: 67px" class="flex_center_center">处理人:</div>
              <el-select
              
                v-model="ycqkObj.handleUser"
                size="large"
                placeholder=" "
                style="width: 260px"
              >
                <el-option
                  v-for="item in optionsSbr"
                  :key="item.account"
                  :label="item.name"
                  :value="item.account"
                />
              </el-select>
            </div> -->
          <div
            style="display: flex; margin-bottom: 10px"
            v-if="bjchShow == 'cl'"
          >
            <div style="width: 78px" class="flex_center_center">处理情况:</div>
            <el-input
              v-model="ycqkObj.handleContent"
              :rows="6"
              type="textarea"
              placeholder="处理结果"
            />
          </div>
          <div
            style="display: flex; margin-bottom: 10px"
            v-if="bjchShow == 'bj'"
          >
            <div style="width: 78px" class="flex_center_center">情况:</div>
            <el-input
              v-model="ycqkObj.content"
              :rows="6"
              type="textarea"
              placeholder="情况说明"
            />
          </div>
        </div>
      </div>
    </div>

    <!-- 值班写入 -->
    <div
      v-if="types == '值班'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">总值班长:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.zzbz"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">值班主任:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.zbzr"
          placeholder="请输入"
        />
      </div>
      <!-- <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">值班民警:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.zbmj"
          placeholder="请输入"
        />
      </div> -->
    </div>
    <!-- 狱情写入 -->
    <div
      v-if="types == '狱情'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">在册:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqzc"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">在押:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqzy"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">实押:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqsy"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">监内住院:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqyw"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">离监探亲:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqlj"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">禁闭:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqbf"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">惩戒训导:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqzx"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">监外住院:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqbz"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">监外执行:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqzs"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 300px">
        <div style="min-width: 70px" class="flex_center_center">历年在逃:</div>
        <el-input
          style="width: 200px"
          v-model="yQobj.yqtp"
          placeholder="请输入"
        />
      </div>
    </div>
    <!--重要犯情 -->
    <div
      v-if="types == '重要'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">重点人头:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.zyzdry"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">狱类案件:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.zyylaj"
          placeholder="请输入"
        />
      </div>
    </div>
    <!--五安全一稳定  -->
    <div
      v-if="types == '安全'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">狱政类:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.aqyz"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">环安类:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.aqha"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">网络舆情:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.aqwl"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">医疗信息:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.aqyl"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">生产类:</div>
        <el-input
          style="width: 260px"
          v-model="yQobj.aqsc"
          placeholder="请输入"
        />
      </div>
    </div>
    <!--突发事件  -->
    <div
      v-if="types == '突发'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 600px">
        <div style="min-width: 70px" class="flex_center_center">突发事件:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.tfsj"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
    </div>
    <!-- 重要会议 -->
    <div
      v-if="types == '重要会议'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 600px">
        <div style="min-width: 70px" class="flex_center_center">重要会议:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.zyhy"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
    </div>
    <!-- 领导视察 -->
    <div
      v-if="types == '领导视察'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 600px">
        <div style="min-width: 70px" class="flex_center_center">领导视察:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.ldsc"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
    </div>
    <!-- 巡查记录 -->
    <div
      v-if="types == '巡查'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 420px">
        <div style="min-width: 100px" class="flex_center_center">到岗履职:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.xcdg"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 420px">
        <div style="min-width: 100px" class="flex_center_center">警容风纪:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.xcjr"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 420px">
        <div style="min-width: 100px" class="flex_center_center">警戒设置:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.xcjj"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 420px">
        <div style="min-width: 100px" class="flex_center_center">
          民警反应问题:
        </div>
        <el-input
          style="width: 420px"
          v-model="yQobj.xcmj"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 420px">
        <div style="min-width: 100px" class="flex_center_center">
          发现的其他问题:
        </div>
        <el-input
          style="width: 420px"
          v-model="yQobj.xcqt"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
    </div>

    <!-- 值班写入 -->
    <div
      v-if="types == '监区'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">A类加班:</div>
        <el-input
          style="width: 260px"
          v-model="ldbaObj.jb"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 70px" class="flex_center_center">B类补丁额:</div>
        <el-input
          style="width: 260px"
          v-model="ldbaObj.bd"
          placeholder="请输入"
        />
      </div>
      <div style="display: flex; margin-bottom: 10px; width: 320px">
        <div style="min-width: 120px" class="flex_center_center">
          C类自愿申请劳动:
        </div>
        <el-input
          style="width: 260px"
          v-model="ldbaObj.ld"
          placeholder="请输入"
        />
      </div>
    </div>

        <!-- 其他 -->
        <div
      v-if="types == '其他'"
      style="transform: translateY(60px)"
      class="save_box"
    >
      <div style="display: flex; margin-bottom: 10px; width: 600px">
        <div style="min-width: 70px" class="flex_center_center">其他:</div>
        <el-input
          style="width: 420px"
          v-model="yQobj.qt"
          type="textarea"
          :rows="4"
          placeholder="请输入"
        />
      </div>
    </div>
    <div class="zfjj_box"></div>
    <div class="dialog-footer">
      <el-button type="primary" @click="saveYcClick()"> 保存 </el-button>
    </div>
  </div>
</template>

<script setup>
import { ElMessage } from "element-plus";
import http from "@/utils/api";
import { throttle } from "lodash";
import {
  Search,
  Share,
  Upload,
  TakeawayBox,
  Refresh,
  Collection,
  Plus,
  Loading,
  FolderDelete,
  Back,
} from "@element-plus/icons-vue";
import {
  ref,
  watch,
  onMounted,
  onBeforeUnmount,
  reactive,
  onBeforeMount,
  nextTick,
  onUnmounted,
} from "vue";
import { defineProps, defineEmits, computed } from "vue";
let activeName = ref("wcl");

let ldbaObj = ref({});
const props = defineProps({
  //类型
  types: {
    type: String,
    default: "",
  },
  //当前行数据
  data: {
    type: Object,
    default: {},
  },
  orgIds: {
    type: Number,
    default: 22,
  },
  //判断值班新增或者编辑
  jcNub: {
    type: Number,
    default: {},
  },
  // 所有警察
  listData: {
    type: Array,
    default: [],
  },
  // 当前登录账号
  account: {
    type: String,
    default: "",
  },
  // 工作交接数据对象
  ggjjObj: {
    type: Object,
    default: {},
  },
  //罪犯人数
  zfrs: {
    type: Number,
    default: 0,
  },
  //罪犯人数
  DailyLength: {
    type: Number,
    default: 0,
  },
  //
  DailyObj: {
    type: Object,
    default: {},
  },
  jqText: {
    type: String,
    default: "",
  },
});

let dateSfm = ref("");
let hour = ref("");
let formDataJJB = ref({});
let daydata = ref("");
const gzqkList = ref([]);

let yQobj = ref({});
// 获取年月日 时
const getFormattedDateTime = () => {
  const now = new Date();
  const year = now.getFullYear();
  const month = String(now.getMonth() + 1).padStart(2, "0");
  const day = String(now.getDate()).padStart(2, "0");
  const hours = String(now.getHours()).padStart(2, "0");
  const minutes = String(now.getMinutes()).padStart(2, "0");
  const seconds = String(now.getSeconds()).padStart(2, "0");
  dateSfm.value = `${hours}:${minutes}:${seconds}`;
  hour.value = String(now.getHours()).padStart(2, "0");
  daydata.value = `${year}-${month}-${day}`;

  return `${year}-${month}-${day} ${hour.value}`;
};
let jqSonArr = ref([]);
let formData = reactive({});
const defaultProps = {
  children: "children",
  label: "name",
  value: "account",
  multiple: true,
  emitPath: false,
};
const optionsSbr = ref([]);
const ycqkObj = ref({});
const gzqkObj = ref({});
const emit = defineEmits(["childEventSon"]);
const back_btn = () => {
  emit("childEventSon", "false");
};

const getPreviousDay = (dateString) => {
  const date = new Date(dateString);
  date.setDate(date.getDate() - 1); // Subtract one day
  const year = date.getFullYear();
  const month = String(date.getMonth() + 1).padStart(2, "0"); // Months are zero-based
  const day = String(date.getDate()).padStart(2, "0");
  return `${year}-${month}-${day}`;
};

const getTimeRanges = () => {
  const now = new Date();

  // 获取今天的日期和时间
  const today = new Date(
    now.getFullYear(),
    now.getMonth(),
    now.getDate(),
    9,
    10,
    0,
    0
  );

  // 获取昨天的日期和时间
  const yesterday = new Date(today);
  yesterday.setDate(today.getDate() - 1);

  // 格式化日期为字符串
  const startDateTime = yesterday.toISOString().slice(0, 19).replace("T", " ");
  const endDateTime = today.toISOString().slice(0, 19).replace("T", " ");

  // 返回时间范围字符串
  return `${startDateTime} 至 ${endDateTime}`;
};

let ycqkList = ref([]);
//异常情况数据
const getExceptionReportSelect = async (is = "0") => {
  let obj = {
    page: 1,
    limit: 99,
    orgId: props.orgIds,
    exceptType: "",
    startDate: "",
    endDate: "",
    state: "0,1",
    reportState: "1,0,2,3,4",
    reportType: "zhzx",
  };
  let res = await http.znjw.ExceptionReportSelect(obj);
  if (!res) return;
  if (res.code == 0) {
    ycqkList.value = res.data.data.filter(
      (item) => item.exceptType == props.data.exceptType
    );
  }
};

let stateYc = ref(true);

let num = ref(0);
watch(
  () => props.types,
  (newValue, oldValue) => {
    yQobj.value = props.DailyObj;
    // console.log(props.DailyObj, "=======");
    jqSonArr.value = JSON.parse(sessionStorage.getItem("jqArr"))
      .filter((item) => item.name.includes("监区"))
      .map((item) => {
        return {
          name: item.name,
        };
      });
    if (props.DailyObj?.ldba) {
      let arrs = JSON.parse(props.DailyObj.ldba);

      jqSonArr.value.forEach((item) => {
        arrs.forEach((itz) => {
          if (itz.name == props.jqText) {
            for (let key in itz) {
                ldbaObj.value[key] = itz[key];
            }
          }

          if (item.name == itz.name) {
            for (let key in itz) {
              item[key] = itz[key];
            }
          }
        });
      });
    }

    console.log(props.DailyObj, "4545");
  },
  {
    deep: true, // 深度监听
    immediate: true, // 立即触发回调
  }
);

const saveYcClick = () => {
  ycsbSave();
  return;
  if (props.types == "罪犯") {
  }
  if (props.types == "值班") {
    handleClickFd();
    // zbSave();
  }

  if (props.types == "工作交接") {
    emit("childEventSon", formDataJJB.value);
  }
};
const handleClickFd = throttle(() => {
  zbSave();
}, 2000); // 1秒的防抖时间
const zbSave = async () => {
  getFormattedDateTime();
  let jsonArr = [];
  let objs = JSON.parse(JSON.stringify(formData));
  Object.entries(objs).forEach(([key, value]) => {
    let item = {
      shift: key,
      zbry: formData[key].join(","),
    };
    jsonArr.push(item);
  });

  let obj = {
    date: daydata.value,
    zbType: 1, //1:值班，2:带班，3:备勤
    type: "zhzx",
    orgId: props.orgIds,
    json: JSON.stringify(jsonArr),
  };
  let res;

  if (props.jcNub) {
    res = await http.base.ZdbUpdate(obj);
  } else {
    res = await http.base.ZdbAdd(obj);
  }

  if (res.code == 0) {
    ElMessage({
      message: "保存成功",
      type: "success",
      plain: true,
    });
    let dateObj = {
      data: JSON.parse(sessionStorage.getItem("formDataJJB")),
      type: props.data.date,
      num: num.value,
      isBs: "值班",
    };

    if (props.data.date == "夜班") {
      emit("childEventSon", dateObj);
      // emit("childEventSon", JSON.parse(sessionStorage.getItem("formDataJJB")));
    } else {
      emit("childEventSon", dateObj);
    }
  }
};

//
const ycsbSave = async () => {
  getFormattedDateTime();
  let res;

  if (props.DailyLength > 0) {
    let obj = {
      id: props.DailyObj.id,
      date: daydata.value,
    };
    for (let key in yQobj.value) {
      if (yQobj.value[key]) {
        if (key != "createDate" && key != "date") {
          obj[key] = yQobj.value[key];
        }
      }
    }
    if (props.types == "监区") {
      jqSonArr.value.forEach((item) => {
        if (item.name == props.jqText) {
          for (let key in ldbaObj.value) {
            item[key] = ldbaObj.value[key];
          }
        }
      });
    }

    obj.ldba = JSON.stringify(jqSonArr.value);

    res = await http.znjw.ZhzxDailyUpdate(obj);
  } else {
    let obj = {
      date: daydata.value,
    };
    for (let key in yQobj.value) {
      if (yQobj.value[key]) {
        if (key != "createDate" && key != "date") {
          obj[key] = yQobj.value[key];
        }
      }
    }
    if (props.types == "监区") {
      jqSonArr.value.forEach((item) => {
        if (item.name == props.jqText) {
          for (let key in ldbaObj.value) {
            item[key] = ldbaObj.value[key];
          }
        }
      });
    }

    obj.ldba = JSON.stringify(jqSonArr.value);

    res = await http.znjw.ZhzxDailyAdd(obj);
  }

  if (res.code == 0) {
    ElMessage({
      message: "保存成功",
      type: "success",
      plain: true,
    });
    ycqkObj.value = {};
    emit("childEventSon", "罪犯");
  }
};
let bjchShow = ref("");
//工作情况编辑
const gzqkhandleEdit = (index, row) => {
  gzqkObj.value = row;
  activeNamegz.value = "xz";
};

const handleEditcl = (index, row) => {
  ycqkObj.value = row;
  activeName.value = "sb";
  stateYc.value = false;
  bjchShow.value = "cl";
};

const handleEdit = (index, row) => {
  let obj = {};
  if (row.state == 0) {
    obj = {
      id: row.id,
      type: row.type,
      reportUser: row.reportUser,
      content: row.content,

      handleContent: row.handleContent,
    };
  }
  if (row.state == 1) {
    obj = {
      id: row.id,
      type: row.type,
      handleUser: row.handleUser,
      handleContent: row.handleContent,
    };
  }
  activeName.value = "sb";
  stateYc.value = false;
  bjchShow.value = "bj";
  ycqkObj.value = Object.assign(obj, {});

  // ycqkObj.value = row;
};
let indexs = ref(0);
const handleDelete = async (row) => {
  console.log(row, "row");
  let res = await http.znjw.ExceptionReportDel({
    id: row.id,
  });
  if (res && res.code == 0) {
    ElMessage({
      message: "删除成功",
      type: "success",
      plain: true,
    });
    getExceptionReportSelect(indexs.value - 1);
  }
};

const handleClickTab = (tab) => {
  if (tab.index == 0) {
    bjchShow.value = "";
  }
  if (tab.index == 1 || tab.index == 0) {
    stateYc.value = true;
    ycqkObj.value = {};
  }
  indexs.value = tab.index;
  getExceptionReportSelect(tab.index - 1);
};

const activeNamegz = ref("xz");
</script>

<style scoped lang="scss">
.save_box {
  color: white;
  display: flex;
  flex-wrap: wrap;
}
::v-deep .el-tag.el-tag--info {
  background: #ff000000;
  color: white;
}
::v-deep .el-input.is-disabled .el-input__wrapper {
  background: #ffffff0d;
  box-shadow: none;
}
::v-deep .el-input__wrapper {
  background: #ffffff0d;
  box-shadow: none;
  color: white;
}
::v-deep .el-input__inner {
  color: white;
}
::v-deep .el-textarea__inner {
  background: #ffffff0d;
  box-shadow: none;
  color: white;
}
::v-deep .el-radio.el-radio--large .el-radio__label {
  color: white;
}

::v-deep .el-form-item__label {
  color: white !important;
}
::v-deep .isTable {
  .el-table .el-table__cell {
    padding: 0px 0px !important;
  }
}

.tb_box {
  transform: translateY(50px);
}
.type_box_text {
  position: absolute;
  top: -44px;
  font-weight: bold;
  font-size: 16px;
  left: 30px;
}

::v-deep .list_box .el-table {
  .cell {
    height: 30px;
    text-align: center;
    // border: 1px solid #ccc;

    font-size: 12px;
    // line-height: 38px;
  }
}
.inco_box {
  height: 180px;
  width: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  .text {
    font-size: 16px;
  }
  .inco {
    width: 50%;
    height: 60px;

    img {
      width: 100%;
      height: 80px;
      transform: translateY(-10px);
    }
  }
}
.type_box {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 20px;
  top: -45px;
  position: absolute;
  left: 31px;
}
.gzjj_box,
.zf_box,
.zb_box,
.jj_box {
  position: absolute;
  left: 26px;
  top: 50px;
  color: white;
  .list_box {
    width: 100%;
    height: 300px;
  }
}
.drawer_box_son {
  width: 100%;
  height: 400px;
  position: relative;
  .back_btn {
    position: absolute;
    left: 16px;
    top: 0px;
  }
  .dialog-footer {
    position: absolute;
    bottom: 80px;
    right: 30px;
    // font-size: 18px;
  }
}
</style>
